package com.example.english;

import android.app.Activity;
import android.os.Build;
import android.view.View;

public class Utils {

    public static void setBarColor(Activity context , boolean setDark){
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
            View decorView = context.getWindow().getDecorView();
            if(decorView != null){
                int vis = decorView.getSystemUiVisibility();
                if(setDark){
                    vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                } else{
                    vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                }
                decorView.setSystemUiVisibility(vis);
            }
        }
    }

}
